<?php

class openapi_api_params_v1_order extends openapi_api_params_abstract implements openapi_api_params_interface{

    public function checkParams($method,$params,&$sub_msg,$defined_params=array(),$dataType='kv'){
        if(parent::checkParams($method,$params,$sub_msg,$defined_params,$dataType)){
            return true;
        }else{
            return false;
        }
    }

    public function getAppParams($method){
        $params = array(
            'add'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'business_goods'=>array('required'=>'true','type'=>'string','name'=>'订货标识'),
                'md5_cart_info'=>array('required'=>'false','type'=>'string','name'=>'购物车数据MD5'),
                'currency'=>array('required'=>'false','type'=>'string','name'=>'货币类型'),
                'pay_app_id'=>array('required'=>'true','type'=>'string','name'=>'支付方式ID'),
                'split_order'=>array('required'=>'false','type'=>'string','name'=>'分单信息'),
                'virtual_cart'=>array('required'=>'false','type'=>'string','name'=>'虚拟购物车订单号'),
                'delivery'=>array('required'=>'true','type'=>'json','name'=>'收货信息',
                    'cols'=>array(
                        'items'=>array(
                            'addr_id' => array('required'=>'true', 'type'=>'string','name'=>'收货地ID'),
                            'ship_area'  => array('required'=>'true',  'type'=>'string','name'=>'收货区域'),
                            'ship_addr_area'  => array('required'=>'true',  'type'=>'string','name'=>'收货区域字符串'),
                            'ship_addr'  => array('required'=>'true',  'type'=>'string','name'=>'收货详细地址'),
                            'ship_zip'  => array('required'=>'true',  'type'=>'string','name'=>'收货地邮编'),
                            'ship_name'  => array('required'=>'true',  'type'=>'string','name'=>'收货人姓名'),
                            'ship_mobile'  => array('required'=>'true',  'type'=>'string','name'=>'手机号'),
                            'ship_tel'  => array('required'=>'true',  'type'=>'string','name'=>'电话'),
                            'region_id'  => array('required'=>'true',  'type'=>'string','name'=>'区域ID'),
                        ),
                    ),
                ),
                'shipping'=>array('required'=>'true','type'=>'json','name'=>'快递信息',
                    'cols'=>array(
                        'items'=>array(
                            'order_split_id' => array('required'=>'true', 'type'=>'string','name'=>'分单店铺ID'),
                            'slips_id'  => array('required'=>'true',  'type'=>'string','name'=>'分单ID'),
                            'ship_addr_area'  => array('required'=>'true',  'type'=>'string','name'=>'收货区域字符串'),
                            'memo'  => array('required'=>'true',  'type'=>'string','name'=>'补充说明'),
                            'shipping_id'  => array('required'=>'true',  'type'=>'string','name'=>'快递ID'),
                        ),
                    ),
                ),
            ),
            'topayment'=>array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id' => array('required'=>'true','type'=>'string','name'=>'订单ID'),
            ),
            'dopayment'=>array(
                'login_token' => array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id' => array('required'=>'true','type'=>'string','name'=>'订单ID'),
                'money' => array('required'=>'true','type'=>'string','name'=>'订单金额'),
                'pay_password' => array('required'=>'true','type'=>'string','name'=>'支付密码'),
            ),
            'orderlist'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'store_id'=>array('required'=>'false','type'=>'string','name'=>'经销商ID'),
                'ordertype'=>array('required'=>'true','type'=>'string','name'=>'订单类型'),
                'time'=>array('required'=>'false','type'=>'string','name'=>'日期内订单'),
                'order_id'=>array('required'=>'false','type'=>'string','name'=>'订单ID'),
                'goods_name'=>array('required'=>'false','type'=>'string','name'=>'商品名称'),
                'goods_bn'=>array('required'=>'false','type'=>'string','name'=>'商品编号'),
                'page_no'=>array('required'=>'false','type'=>'int','name'=>'分页页码'),
                'order_type'=>array('required'=>'false','type'=>'int','name'=>'排序方式'),
            ),
            'orderdetail'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
                'store_id'=>array('required'=>'false','type'=>'string','name'=>'经销商ID'),
            ),
            'docancel'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
                'op'=>array('required'=>'true','type'=>'string','name'=>'操作方'),
            ),
            'remind'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
            ),
            'gofinish'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
                'pay_password'=>array('required'=>'true','type'=>'string','name'=>'支付密码'),
            ),
            'part_receipt'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
                'pay_password'=>array('required'=>'true','type'=>'string','name'=>'支付密码'),
            ),
            'todiscuss'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
            ),
            'dodiscuss'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'content'=>array('required'=>'true','name'=>'评论对象','type'=>'json',
                    'cols'=>array(
                        'order_id'=>array('required'=>'true','name'=>'订单号','type'=>'string'),
                        'goods_info'=>array('required'=>'true','name'=>'商品','type'=>'array',
                            'items'=>array(//
                                'id'=>array('required'=>'true','name'=>'商品id','type'=>'string'),
                                'goods_point'=>array('required'=>'true','name'=>'商品评论','type'=>'array',
                                    'items'=>array(//
                                        'type_id' =>array('required'=>'true','name'=>'评论类型id','type'=>'string'),
                                        'score' => array('required'=>'true','name'=>'评论分数','type'=>'string'),
                                    ),
                                ),
                                'comment'=>array('required'=>'true','name'=>'评论内容','type'=>'string'), 
                                'hidden_name'=>array('required'=>'false','name'=>'匿名评论','type'=>'string'),               
                            ),
                        ),
                        'point_type'=>array('required'=>'true','name'=>'其他评论','type'=>'array',
                            'items'=>array(//
                                'type_id' =>array('required'=>'true','name'=>'评论类型id','type'=>'string'),
                                'score' => array('required'=>'true','name'=>'评论分数','type'=>'string'),
                            ),
                        ),                    
                    ),
                ),
            ),
            'extend_finish_apl'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
            ),
            'torefund'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
            ),
            'dorefund'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'order_id'=>array('required'=>'true','type'=>'string','name'=>'订单ID'),
                'gorefund_price'=>array('required'=>'true','type'=>'string','name'=>'退款金额'),
                'comment'=>array('required'=>'true','type'=>'string','name'=>'退款原因'),
                'content'=>array('required'=>'false','type'=>'string','name'=>'退款说明'),
                'product_data'=>array('required'=>'true','type'=>'string','name'=>'商品信息'),
                'image_file'=>array('required'=>'false','type'=>'string','name'=>'凭证图片'),
                'image_file1'=>array('required'=>'false','type'=>'string','name'=>'凭证图片1'),
                'image_file2'=>array('required'=>'false','type'=>'string','name'=>'凭证图片2'),
            ),
            'splitCombineGoods'=>array(
                'login_token'=>array('required'=>'true','type'=>'string','name'=>'登录token'),
                'goods_id'=>array('required'=>'true','type'=>'string','name'=>'商品ID'),
                'num'=>array('required'=>'false','type'=>'string','name'=>'拆分数量'),
            ),
        );

        return $params[$method];
    }

    public function description($method){
        $desccription = array(
            'add'=>array(
                'name'        =>'订单接口',
                'description' =>'订单生成接口',
            ),
            'topayment'=>array(
                'name'        =>'订单支付页面',
                'description' =>'订单支付页面',
            ),
            'orderlist'=>array(
                'name'        =>'订单列表接口',
                'description' =>'获取订单列表接口',
            ),
            'orderdetail'=>array(
                'name'        =>'订单详情接口',
                'description' =>'获取订单详情接口',
            ),
            'docancel'=>array(
                'name'        =>'取消订单接口',
                'description' =>'取消订单接口',
            ),
            'remind'=>array(
                'name'=>'提醒卖家发货',
                'description'=>'提醒卖家发货接口',
            ),
            'gofinish'=>array(
                'name'=>'确认收货',
                'description'=>'确认收货接口',
            ),
            'part_receipt'=>array(
                'name'=>'部分收货',
                'description'=>'部分收货接口',
            ),
            'todiscuss'=>array(
                'name'=>'评论项',
                'description'=>'获取评论项',
            ),
            'dodiscuss'=>array(
                'name'=>'评论',
                'description'=>'提交评论接口',
            ),
            'extend_finish_apl'=>array(
                'name'=>'延长收货时间',
                'description'=>'延长收货时间接口',
            ),
            'torefund'=>array(
                'name'=>'申请退款',
                'description'=>'延长收货时间接口',
            ),
            'dorefund'=>array(
                'name'=>'提交退款申请',
                'description'=>'提交退款申请接口',
            ),
            'splitCombineGoods'=>array(
                'name'=>'拆分商品',
                'description'=>'拆分商品接口',
            ),
        );
        return $desccription[$method];
    }
}